const express = require("express");
const path = require("path");

const app = express();

// express.static(目录路径)
// app.use(express.static(path.resolve(__dirname, "./public")));

// index.html     http://localhost:3000/index.html     /
// about.html     /about.html
// base.css       /base.css
// index.js       /index.js
// css/index.css  /css/index.css

app.use("/abc", express.static(path.resolve(__dirname, "./public")));

// index.html     http://localhost:3000/abc/index.html     /abc
// about.html     /abc/about.html
// base.css       /abc/base.css
// index.js       /abc/index.js
// css/index.css  /abc/css/index.css

app.listen(3000, () => {
  console.log("服务启动成功 http://localhost:3000");
});
